<template>
	<view class="container">
		<view class="top-box">
			<view class="content-box">
				<view class="avatar-box">
					<view class="avatar">
						<image :src="studentInfo.userAvatar"></image>
					</view>
					<view class="name">{{studentInfo.userName}}</view>
				</view>
				<view class="line"></view>
				<view class="item-box">
					<view class="item-label">生源地</view>
					<view class="item-content">河南省</view>
				</view>
			</view>
		</view>
		<view class="info-box">
			<view class="content-box">
				<view class="item-box">
					<view class="item-label">学校</view>
					<view class="item-content">{{studentInfo.cityName}}{{studentInfo.highSchoolName}}</view>
				</view>
				<view class="item-box">
					<view class="item-label">班级</view>
					<view class="item-content">{{studentInfo.highSchoolClassName}}</view>
				</view>
				<view class="item-box">
					<view class="item-label">身份证</view>
					<view class="item-content">{{studentInfo.userIdcard}}</view>
				</view>
				<view class="item-box">
					<view class="item-label">最近模拟分数</view>
					<view class="item-content">{{studentInfo.userSimulateScore}}</view>
				</view>
				<view class="item-box">
					<view class="item-label">高考分数</view>
					<view class="item-content">{{studentInfo.userTestScore}}</view>
				</view>
				<view class="item-box">
					<view class="item-label">文理科</view>
					<view class="item-content">{{studentInfo.userSubjectShow}}</view>
				</view>
			</view>
		</view>
		<view class="send-box" v-if="userInfo.userType != 1">
			<view class="send-btn" @tap="goPrivateChat">与考生私聊</view>
		</view>
	</view>
</template>

<script>
	import {
		http,
		showToastMsg
	} from '../../utils'
	
	export default {
		data() {
			return {
				id: 0,
				userInfo: null,
				studentInfo: null
			}
		},
		
		onLoad(options) {
			this.id = options.id
			this.userInfo = uni.getStorageSync('userInfo')
			this.fetchData()
		},
		
		methods: {
			
			fetchData() {
				const that = this
				http('/user/studentinfo', {studentId: id}).then(res => {
					if (res.code == 20000) {
						that.studentInfo = res.data
					}
				})
			},
			
			goPrivateChat() {
				const that = this
				uni.navigateTo({
					url: '/pages/private_chat/private_chat?id=' + that.id
				})
			}
			
		}
	}
</script>

<style>
	page {
		background-color: #f5f5f5;
	}
	
	.line {
		width: 100%;
		height: 2rpx;
		background-color: #f5f5f5;
	}
	
	.top-box {
		width: 750rpx;
		background-color: #ffffff;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 10rpx;
	}
	
	.content-box {
		width: 700rpx;
	}
	
	.avatar-box {
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-top: 30rpx;
		margin-bottom: 30rpx;
	}
	
	.avatar image {
		width: 120rpx;
		height: 120rpx;
		border-radius: 60rpx;
	}
	
	.name {
		margin-left: 40rpx;
		color: #333333;
		font-size: 36rpx;
	}
	
	.item-box {
		width: 100%;
		height: 110rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		color: #333333;
		font-size: 30rpx;
	}
	
	.info-box {
		background-color: #ffffff;
		margin-top: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.send-box {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 750rpx;
		height: 98rpx;
		background-color: #ffffff;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	
	.send-btn {
		width: 700rpx;
		height: 78rpx;
		background-image: linear-gradient(90deg, #ff8806 0%, #fbae2b 100%), linear-gradient(#4482f8, #4482f8);
		border-radius: 40rpx;
		color: #ffffff;
		font-size: 36rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
</style>
